//
//  HelperViewController.m
//  Unicorn
//
//  Created by xalo on 16/5/3.
//  Copyright © 2016年 bhj_jun. All rights reserved.
//

#import "HelperViewController.h"

@interface HelperViewController ()<UITextViewDelegate>

@property (nonatomic,retain) UITextView *textView;

@end

@implementation HelperViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.title = @"帮助与反馈";

    //界面设置
    [self viewSetting];
    

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - - 懒加载
//UITextView
-(UITextView *)textView
{
    
    if (_textView == nil) {
        _textView = [[UITextView alloc]initWithFrame:CGRectMake(0, 120, kWidth, 150)];
        _textView.text = @"请留下您的宝贵意见吧！";
        _textView.textAlignment = NSTextAlignmentLeft;
        _textView.layer.borderWidth = 2.0;
        _textView.layer.cornerRadius = 5.0;
        _textView.delegate = self;
    }
    return _textView;
}

#pragma mark - - 界面设置
-(void)viewSetting
{
     [self.view addSubview:self.textView];
    
    //左侧返回
    self.navigationItem.leftBarButtonItem =({

    UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithTitle:@"back" style:UIBarButtonItemStyleDone target:self action:@selector(backAction:)];
        item;
    });

    UILabel *label        = [[UILabel alloc]initWithFrame:CGRectMake(5, 80, kWidth, 30)];
    label.text = @"您的意见是我们进步的源泉:";
    [self.view addSubview:label];
 
    //发送
    UIButton *sendBtn = [[SingleExE sharedHandle]setButtonWithTitle:@"发送" frame:CGRectMake(kWidth/2-75,kHeight/2, 150, 40)];
//    sendBtn.center = self.view.center;
    sendBtn.layer.borderWidth = 1.0;
    sendBtn.layer.borderColor = [[UIColor grayColor]CGColor];
    sendBtn.layer.cornerRadius = 10;
    [sendBtn addTarget:self action:@selector(sendBtnAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:sendBtn];
    
}

#pragma mark - - 返回事件回调
//返回事件
-(void)backAction:(UIBarButtonItem *)sender
{
    [self.navigationController popToViewController:self.navigationController.viewControllers.firstObject animated:YES];
    
}

//发送事件
-(void)sendBtnAction:(UIButton *)sender
{
    
}


#pragma mark - - TextView代理
//点击空白处,取消第一响应(键盘的回收)
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    
    [self.textView resignFirstResponder];
}


@end
